﻿using System.Reflection;

namespace _75_C_反射泛型类和泛型方法
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Assembly assembly = Assembly.LoadFrom("TestClassLibrary.dll");
            //加载类型  程序集名称.类型命名
            Type type = assembly.GetType("TestClassLibrary.Student");

            //Type type1 = assembly.GetType("TestClassLibrary.Student、2").MakeGenericType(new Type[] { });//这个里面有多个泛型就标记几个
            //实例化对象
            Object obj = Activator.CreateInstance(type);

            MethodInfo methodInfo = type.GetMethod("Study").MakeGenericMethod(new Type[] {typeof(string),typeof(int)});
            methodInfo.Invoke(obj, new object[] { "张同学", 19 });
        }
    }
}
